package jjn.carl.greedy;

import java.util.Arrays;

/**
 * @author Jiang Jining
 * @since 2023-06-14 23:57
 */
public class LeetCode455_AssignCookies {
    public int findContentChildren(int[] g, int[] s) {
        Arrays.sort(g);
        Arrays.sort(s);
        int result = 0, used = 0;
        for (int i = 0; i < g.length && used < s.length; used++) {
            if (s[used] >= g[i]) {
                result++;
                i++;
            }
        }
        return result;
    }
}
